// JavaScript Document
function validate(){
	
var empno = document.getElementById('txtEmpno');	
var date = document.getElementById('txtDy');	
var inn = document.getElementById('sltIn');	
var out = document.getElementById('sltOut');



if(notEmpty(empno, "Employee Number cannot be empty")){
	if(isNumeric(empno, "Employee Number should be numeric ")){
			    if(madeSelection(date, "Select the date")){
					 if(madeSelection(inn, "Select in time")){
	                      if(madeSelection(out, "Select the out time")){
	
	                                loadXMLDoc();
	
			                  
							 }
					    return false;
					   }
				 return false;
				}
		      return false;
			 }
		 return false;
		}
	 return false;
	}

	
	function loadXMLDoc()
{


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		
    document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText;
	//document.getElementById("myForm").reset(); 
	
    }
  }

                var empno = document.getElementById('txtEmpno').value;	
                //var year = document.getElementById('sltYr').value;	
                //var month = document.getElementById('sltMon').value;	
                var date = document.getElementById('txtDy').value;	
                var inn = document.getElementById('sltIn').value;	
                var out = document.getElementById('sltOut').value;
				var id = document.getElementById('id').value;
				
	
	var queryString ="?empno=" + empno +"&date="+date+ "&in=" + inn +"&out="+out+ "&id=" + id;
	
xmlhttp.open("GET","../logic/update/att_employee_update.php"+queryString ,true);
xmlhttp.send();
}

function checkempno(){

var empno = document.getElementById('txtEmpno');	

if(notEmpty(empno, "Employee Number cannot be empty")){

 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
    }
  else
   {// code for IE6, IE5
 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
    xmlhttp.onreadystatechange=function()
     {
 if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
									//document.getElementById("ajaxDiv").innerHTML=xmlhttp.responseText; 
									 
   var x=xmlhttp.responseText;
if(x=="false"){
									
  document.getElementById("ajaxDiv1").innerHTML="Invalid Employee No";
  document.getElementById('txtEmpno').value="";
	}else{
  document.getElementById("ajaxDiv1").innerHTML=x; 
									
			}
			}
            }
								
  var y=document.getElementById('txtEmpno').value;
  var queryString ="?empno=" + y;
  xmlhttp.open("GET","../logic/load/check_emp.php"+queryString,true);
  xmlhttp.send();	  
	
	
}

}




function backxx()
   {
	
	var startrow=document.getElementById('startrow').value;
	var tag=document.getElementById('tag').value;
	
	if(tag ==1){
		//alert("asdasd");
		//$var="?tab=" + tab +"&startrow="+startrow;
		document.location="../admin/admin_home.php?tab=att_employee_search&page="+startrow;
		}else {
			document.location="att_employee_searchx.php?page="+startrow;
			}
	
	}